package team.knowers.qzh.qzhadmin.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import team.knowers.qzh.qzhadmin.config.convention.result.Result;
import team.knowers.qzh.qzhadmin.config.convention.result.Results;
import team.knowers.qzh.qzhadmin.dto.resp.AllChapterRespDTO;
import team.knowers.qzh.qzhadmin.service.ChapterAdminService;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class ChapterAdminController {
    private final ChapterAdminService chapterAdminService;
    /**
     * 展示该课程的所有单元
     * @param id
     * @return
     */
    @GetMapping("/api/qzh-admin/admin/v1/chapter/show/{id}")
    public Result<List<AllChapterRespDTO>> showAllChapter(@PathVariable("id") Long id)
    {
        return Results.success(chapterAdminService.showAllChapter(id));
    }
}
